package top.alanshelby.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import top.alanshelby.entity.Item;
import top.alanshelby.entity.ItemExample;
import top.alanshelby.mapper.ItemMapper;

import java.util.List;

@Service
public class ItemServiceImpl implements ItemService {

    @Autowired
    private ItemMapper itemMapper;

    @Override
    public List<Item> findItemList() {
        ItemExample example = new ItemExample();
        List<Item> itemList = itemMapper.selectByExample(example);
        return itemList;
    }

    @Override
    public Item getItemById(Integer id) {
        return id == null ? null : itemMapper.selectByPrimaryKey(id);
    }
}
